# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.

# (generated with --quick)

import __future__

import _weakref
import contextlib
from typing import (
    Any,
    Callable,
    Dict,
    Generator,
    Iterable,
    Iterator,
    List,
    NoReturn,
    Optional,
    Set,
    Tuple,
    Type,
    TypeVar,
    Union,
)

# pyre-fixme[21]: Could not find module `sapling.connectionpool`.
import sapling.connectionpool

# pyre-fixme[21]: Could not find module `sapling.context`.
import sapling.context

# pyre-fixme[21]: Could not find module `sapling.filelog`.
import sapling.filelog

# pyre-fixme[21]: Could not find module `sapling.lock`.
import sapling.lock

# pyre-fixme[21]: Could not find module `sapling.namespaces`.
import sapling.namespaces

# pyre-fixme[21]: Could not find module `sapling.pathutil`.
import sapling.pathutil

# pyre-fixme[21]: Could not find module `sapling.peer`.
import sapling.peer

# pyre-fixme[21]: Could not find module `sapling.phases`.
import sapling.phases

# pyre-fixme[21]: Could not find module `sapling.repository`.
import sapling.repository

# pyre-fixme[21]: Could not find module `sapling.scmutil`.
import sapling.scmutil

# pyre-fixme[21]: Could not find module `sapling.store`.
import sapling.store

# pyre-fixme[21]: Could not find module `sapling.urllibcompat`.
import sapling.urllibcompat

# pyre-fixme[21]: Could not find module `sapling.util`.
import sapling.util

# pyre-fixme[21]: Could not find module `sapling.vfs`.
import sapling.vfs

_T = TypeVar("_T")
_T0 = TypeVar("_T0")
_T1 = TypeVar("_T1")
# pyre-fixme[11]: Annotation `_basepeer` is not defined as a type.
_Tlocalpeer = TypeVar("_Tlocalpeer", bound="sapling.repository._basepeer")
_Tlocalrepository = TypeVar("_Tlocalrepository", bound=localrepository)

# pyre-fixme[11]: Annotation `filecache` is not defined as a type.
class _basefilecache(sapling.scmutil.filecache):
    __doc__: str
    def __delete__(self, obj) -> None: ...
    def __get__(self, obj, type=...) -> Any: ...
    def __set__(self, obj, value) -> None: ...

# pyre-fixme[11]: Annotation `propertycache` is not defined as a type.
class filteredpropertycache(sapling.util.propertycache):
    __doc__: str

# pyre-fixme[11]: Annotation `legacypeer` is not defined as a type.
class locallegacypeer(sapling.repository.legacypeer, localpeer):
    __doc__: str
    _caps: Any
    _repo: Any
    _ui: Any
    def __init__(self, repo) -> None: ...
    def between(self, pairs) -> Any: ...
    def branches(self, nodes) -> Any: ...
    def changegroup(self, nodes, kind) -> Any: ...
    def changegroupsubset(self, bases, heads, kind) -> Any: ...

# pyre-fixme[11]: Annotation `peer` is not defined as a type.
class localpeer(sapling.repository.peer):
    __doc__: str
    _caps: Any
    _repo: Any
    _ui: Any
    ui: Any
    def __init__(self, repo, caps=...) -> None: ...
    def branchmap(self) -> Any: ...
    def canpush(self) -> bool: ...
    def capabilities(self) -> Set[str]: ...
    def close(self) -> None: ...
    def debugwireargs(self, one, two, three=..., four=..., five=...) -> str: ...
    def getbundle(
        self, source, heads=..., common=..., bundlecaps=..., **kwargs
    ) -> Any: ...
    def heads(self, *args, **kwargs) -> list: ...
    # pyre-fixme[11]: Annotation `localiterbatcher` is not defined as a type.
    def iterbatch(self) -> sapling.peer.localiterbatcher: ...
    def known(self, nodes) -> Any: ...
    def listkeys(self, namespace) -> Any: ...
    def local(self) -> Any: ...
    def lookup(self, key) -> Any: ...
    # pyre-fixme[34]: `Variable[_Tlocalpeer (bound to
    #  sapling.repository._basepeer)]` isn't present in the function's parameters.
    def peer(self: _Tlocalpeer) -> _Tlocalpeer: ...
    def pushkey(self, namespace, key, old, new) -> Any: ...
    def stream_out(self, shallow=...) -> NoReturn: ...
    def unbundle(self, bundle, heads, url) -> Any: ...
    def url(self) -> Any: ...

class localrepository:
    __doc__: str
    _activebookmark: Any
    _basestoresupported: Set[str]
    _basesupported: Set[str]
    _bookmarks: Any
    _branchcaches: Dict[Any, Any]
    _datafilters: dict
    _decodefilterpats: Any
    _dirstatevalidatewarned: bool
    _eden_dirstate: Any
    _encodefilterpats: Any
    _eventreporting: bool
    _filecache: Dict[str, Any]
    _lockfreeprefix: Set[str]
    _lockref: Optional[_weakref.ReferenceType[Any]]
    _mutationstore: Any
    # pyre-fixme[11]: Annotation `phasecache` is not defined as a type.
    _phasecache: sapling.phases.phasecache
    _phasedefaults: List[Any]
    _postdsstatus: List[Tuple[Any, Any]]
    _transref: Optional[_weakref.ReferenceType[Any]]
    _wlockfreeprefix: Set[str]
    _wlockref: Optional[_weakref.ReferenceType[Any]]
    # pyre-fixme[11]: Annotation `pathauditor` is not defined as a type.
    auditor: sapling.pathutil.pathauditor
    # pyre-fixme[11]: Annotation `ui` is not defined as a type.
    baseui: sapling.ui.ui
    # pyre-fixme[11]: Annotation `vfs` is not defined as a type.
    cachevfs: sapling.vfs.vfs
    # pyre-fixme[11]: Annotation `connectionpool` is not defined as a type.
    connectionpool: sapling.connectionpool.connectionpool
    # pyre-fixme[11]: Annotation `dirstate` is not defined as a type.
    dirstate: sapling.dirstate.dirstate
    disableeventreporting: Callable[..., contextlib._GeneratorContextManager]
    featuresetupfuncs: Set[Any]
    fileservice: Any
    fileslog: Any
    filteredrevcache: Dict[Any, Any]
    filterpats: Dict[Any, List[Tuple[Any, Any, Any]]]
    localvfs: sapling.vfs.vfs
    manifestlog: Any
    # pyre-fixme[11]: Annotation `namespaces` is not defined as a type.
    names: sapling.namespaces.namespaces
    nofsauditor: sapling.pathutil.pathauditor
    obsstore: Any
    openerreqs: Set[str]
    origroot: str
    path: str
    prepushoutgoinghooks: Any
    requirements: Any
    root: str
    sharedfeatures: Set[str]
    sharedpath: str
    sharedroot: str
    sharedvfs: Optional[sapling.vfs.vfs]
    sjoin: Callable[[Any], Any]
    spath: str
    # pyre-fixme[11]: Annotation `basicstore` is not defined as a type.
    store: sapling.store.basicstore
    storefeaturesetupfuncs: Set[Any]
    storerequirements: Set[str]
    storesupported: Set[str]
    supported: Set[str]
    supportedformats: Set[str]
    svfs: sapling.vfs.vfs
    ui: sapling.ui.ui
    vfs: sapling.vfs.vfs
    wvfs: sapling.vfs.vfs
    def __bool__(self) -> bool: ...
    def __contains__(self, changeid) -> bool: ...
    def __getitem__(self, changeid) -> Any: ...
    def __init__(self, baseui, path, create=...) -> None: ...
    def __iter__(self) -> Any: ...
    def __len__(self) -> int: ...
    def __nonzero__(self) -> bool: ...
    def _afterlock(self, callback) -> None: ...
    def _applyopenerreqs(self) -> None: ...
    def _buildcacheupdater(self, newtransaction) -> Callable[[Any], Any]: ...
    def _constructmanifest(self) -> Any: ...
    def _currentlock(self, lockref) -> Any: ...
    def _dirstatevalidate(self, node: bytes) -> bytes: ...
    def _featuresetup(self, setupfuncs, basesupported: _T1) -> Union[Set, _T1]: ...
    def _filecommit(
        self, fctx, manifest1, manifest2, linkrev, tr, changelist
    ) -> Any: ...
    def _filter(self, filterpats, filename, data) -> Any: ...
    def _getsvfsward(self, origfunc) -> Callable: ...
    def _getvfsward(self, origfunc) -> Callable: ...
    def _httpgetdesignatednodes(self, keys: Iterable[Tuple[str, bytes]]): ...
    def _journalfiles(
        self,
    ) -> Tuple[
        Tuple[Any, str],
        Tuple[sapling.vfs.vfs, str],
        Tuple[sapling.vfs.vfs, str],
        Tuple[sapling.vfs.vfs, str],
        Tuple[Any, str],
        Tuple[Any, str],
        Tuple[Any, str],
    ]: ...
    def _loadextensions(self) -> None: ...
    def _loadfilter(self, filter) -> List[Tuple[Any, Any, Any]]: ...
    def _narrowheadsmigration(self) -> None: ...
    def _prefetchtrees(
        self,
        rootdir: str,
        mfnodes: Iterable[bytes],
        basemfnodes: List[bytes],
        directories: List[str],
        depth: Optional[int] = None,
    ): ...
    def _refreshfilecachestats(repo: localrepository, *args, **kwargs) -> None: ...
    def _restrictcapabilities(self, caps: Set[str]) -> Set[str]: ...
    def _rollback(repo: localrepository, *args, **kwargs) -> int: ...
    def _shouldusehttp(self) -> bool: ...
    def _syncrevlogtozstore(self) -> None: ...
    def _writejournal(repo: localrepository, *args, **kwargs) -> None: ...
    def _writerequirements(self) -> None: ...
    def _writestorerequirements(self) -> None: ...
    def _zstorecommitdatamigration(self) -> None: ...
    def adddatafilter(self, name, filter) -> None: ...
    def addpostdsstatus(self, ps, afterdirstatewrite=...) -> None: ...
    def anyrevs(self, specs, user=..., localalias=...) -> Any: ...
    def automigratefinish(self) -> None: ...
    def automigratestart(self) -> None: ...
    def between(self, pairs) -> List[List[Any]]: ...
    def branches(self, nodes) -> List[Tuple[Any, Any, Any, Any]]: ...
    def branchheads(self, branch=..., start=..., closed=...) -> List[Any]: ...
    def branchmap(self) -> Any: ...
    def branchtip(self, branch, ignoremissing=...) -> Any: ...
    def cancopy(self) -> bool: ...
    def changectx(
        self,
        # pyre-fixme[11]: Annotation `basectx` is not defined as a type.
        changeid: Union[int, str, bytes, sapling.context.basectx],
    ) -> sapling.context.basectx: ...
    def checkcommitpatterns(self, wctx, match, status, fail) -> None: ...
    def checkpush(self, pushop) -> None: ...
    def clearpostdsstatus(self) -> None: ...
    def close(self) -> None: ...
    def commit(repo: localrepository, *args, **kwargs) -> Any: ...
    def commitctx(repo: localrepository, *args, **kwargs) -> Any: ...
    def commitpending(repo: localrepository, *args, **kwargs) -> None: ...
    def currenttransaction(self) -> Any: ...
    def currentwlock(self) -> Any: ...
    def debugwireargs(self, one, two, three=..., four=..., five=...) -> str: ...
    def destroyed(self) -> None: ...
    def destroying(self) -> None: ...
    # pyre-fixme[11]: Annotation `filelog` is not defined as a type.
    def file(self, f) -> sapling.filelog.filelog: ...
    # pyre-fixme[11]: Annotation `filectx` is not defined as a type.
    def filectx(self, path, changeid=..., fileid=...) -> sapling.context.filectx: ...
    def getcwd(self) -> str: ...
    def headrevs(
        self, start=..., includepublic=..., includedraft=..., reverse=...
    ) -> List[int]: ...
    def heads(self, start=..., includepublic=..., includedraft=...) -> List[bytes]: ...
    def hook(self, name: str, throw: bool = ..., **args) -> Any: ...
    def invalidate(self, clearfilecache=...) -> None: ...
    def invalidateall(self) -> None: ...
    def invalidatecaches(self) -> None: ...
    def invalidatedirstate(self) -> None: ...
    def invalidatevolatilesets(self) -> None: ...
    def known(self, nodes) -> List[bool]: ...
    def listkeys(self, namespace: str) -> Any: ...
    def local(self) -> localrepository: ...
    def lock(self, wait: bool = ...) -> Any: ...
    def lookup(self, key) -> Any: ...
    def lookupbranch(self, key, remote=...) -> Any: ...
    def nodebookmarks(self, node) -> list: ...
    def nodes(self, expr, *args) -> Generator[Any, Any, None]: ...
    def pathto(self, f, cwd=...) -> Any: ...
    def peer(self) -> localpeer: ...
    def postdsstatus(self, afterdirstatewrite=...) -> list: ...
    def prefetchtrees(
        self,
        mfnodes: Iterable[bytes],
        basemfnodes: Optional[List[bytes]] = None,
        depth: Optional[int] = None,
    ): ...
    def publishing(self) -> Any: ...
    def pushkey(self, namespace, key, old, new) -> Any: ...
    def recover(self) -> bool: ...
    def revs(self, expr, *args) -> Any: ...
    def rollback(self, dryrun=..., force=...) -> Any: ...
    def savecommitmessage(self, text) -> Any: ...
    def set(self, expr, *args) -> Generator[Any, Any, None]: ...
    def setparents(self, p1, p2=...) -> None: ...
    def shared(self) -> Optional[str]: ...
    def status(
        self, node1=..., node2=..., match=..., ignored=..., clean=..., unknown=...
    ) -> Any: ...
    def transaction(self, desc, report=...) -> Any: ...
    def undofiles(self) -> List[Tuple[Any, Any]]: ...
    def updatecaches(repo: localrepository, *args, **kwargs) -> None: ...
    def url(self) -> str: ...
    def walk(self, match, node=...) -> Any: ...
    def wjoin(self, f, *insidef) -> str: ...
    def wlock(self, wait=...) -> Any: ...
    def wread(self, filename) -> bytes: ...
    def wwrite(self, filename, data, flags, backgroundclose=...) -> int: ...
    def wwritedata(self, filename, data) -> Any: ...

class repofilecache(_basefilecache):
    __doc__: str
    def __init__(self, localpaths=..., sharedpaths=...) -> None: ...
    def localjoin(self, obj, fname) -> Any: ...
    def sharedjoin(self, obj, fname) -> Any: ...

class storecache(_basefilecache):
    __doc__: str
    def join(self, obj, fname) -> Any: ...

class unfilteredpropertycache(sapling.util.propertycache):
    __doc__: str
    def __get__(self, obj, type=...) -> Any: ...

def aftertrans(files) -> Callable[[], Any]: ...
def hasunfilteredcache(repo, name) -> bool: ...
def instance(ui, path, create) -> localrepository: ...
def isfilecached(repo, name) -> Tuple[Any, bool]: ...
def islocal(path) -> bool: ...
def newreporequirements(repo: localrepository) -> Set[str]: ...
def newrepostorerequirements(repo: localrepository) -> Set[str]: ...
def release(*locks) -> None: ...
def undoname(fn) -> Any: ...
def unfilteredmethod(orig) -> Callable: ...
